package com.mimiwang.school.service.impl;

import com.mimiwang.school.domain.City;
import com.mimiwang.school.domain.Province;
import com.mimiwang.school.mapper.AddressMapper;
import com.mimiwang.school.service.IAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @AUTHOR:游李滨
 * @DATE:2023/5/1 15:50
 */

@Service
public class AddressServiceImpl implements IAddressService {

    @Autowired
    AddressMapper addressMapper;

    @Cacheable(value = "province" )
    @Override
    public List<Province> selectAllProvince() {
        return addressMapper.selectAllProvince();
    }
    @Cacheable(value = "city" ,key = "#pId")
    @Override
    public List<City> selectCityListByProvinceId(long pId) {
        return addressMapper.selectCityListByProvinceId(pId);
    }
}
